﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="keywords" content="jQuery DropDownList, List, ListBox, Popup List, jqxDropDownList, jqxListBox, List Widget, ListBox Widget, DropDownList Widget" /> 
    <meta name="description" content="The jqxListBox can display checkboxes next to its items. You can enable this feature by setting the 'checkboxes' property to true."/>
    <title id='Description'>The jqxListBox can display checkboxes next to its items. You can enable this feature by setting the 'checkboxes' property to true. </title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
</head>
<body>
    <div id='content'>
        <script type="text/javascript">
            $(document).ready(function () {
                var source = [
                    "Affogato",
                    "Americano",
                    "Bicerin",
                    "Breve",
                    "Café Bombón",
                    "Café au lait",
                    "Caffé Corretto",
                    "Café Crema",
                    "Caffé Latte",
                    "Caffé macchiato",
                    "Café mélange",
                    "Coffee milk",
                    "Cafe mocha",
                    "Cappuccino",
                    "Carajillo",
                    "Cortado",
                    "Cuban espresso",
                    "Espresso",
                    "Eiskaffee",
                    "The Flat White",
                    "Frappuccino",
                    "Galao",
                    "Greek frappé coffee",
                    "Iced Coffee﻿",
                    "Indian filter coffee",
                    "Instant coffee",
                    "Irish coffee",
                    "Liqueur coffee"
		        ];

                // Create a jqxListBox
                $("#listbox").jqxListBox({width: 200, source: source, checkboxes: true, height: 250});
                // Check several items.
                $("#listbox").jqxListBox('checkIndex', 0);
                $("#listbox").jqxListBox('checkIndex', 1);
                $("#listbox").jqxListBox('checkIndex', 2);
                $("#listbox").jqxListBox('checkIndex', 5);

                $("#listbox").on('checkChange', function (event) {
                    var args = event.args;
                    if (args.checked) {
                        $("#Events").text("Checked: " + args.label);
                    }
                    else {
                        $("#Events").text("Unchecked: " + args.label);
                    }

                    var items = $("#listbox").jqxListBox('getCheckedItems');
                    var checkedItems = "";
                    $.each(items, function (index) {
                        if (index < items.length - 1) {
                            checkedItems += this.label + ", ";
                        }
                        else checkedItems += this.label;
                    });
                    $("#CheckedItems").text(checkedItems);
                });
            });
        </script>
        <div id='jqxWidget'>
            <div id="listbox"></div>
            <div style="font-size: 13px; font-family: Verdana; margin-top: 20px;" id="Events"></div>
            <div style="font-size: 13px; font-family: Verdana; margin-top: 10px;" id="CheckedItems"></div>
        </div>
    </div>
</body>
</html>
